home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / games / 73 / pascal / joytest.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1986-11-21  |  928 b   |  33 lines

  1. { This program demonstrates how to call the routines in the joysubs.o module. }
  2. PROGRAM joytest;
  3.  
  4.   VAR c: char;
  5.  
  6.   { These 3 routines are in the joysubs file-- we need to declare them EXTERNAL
  7.     here: }
  8. { Call this before calling Stick() to turn off the mouse }
  9.   PROCEDURE Init_Stick;
  10.     EXTERNAL;
  11. { Call this to turn the mouse back on }
  12.   PROCEDURE End_Stick;
  13.     EXTERNAL;
  14. { Call this routine to get the current joystick value.  The values returned
  15.   for the eight directions are as follows:
  16.      5 1 9
  17.       \|/       If the trigger is depressed, the 128 will be added to the
  18.      4-0-8      direction value
  19.       /|\
  20.      6 2 10
  21.   "which_stick" should be given the value 0 or 1. }
  22.   FUNCTION Stick( which_stick: integer ): integer;
  23.     EXTERNAL;
  24.  
  25.   BEGIN
  26.     Init_Stick;
  27.     REPEAT
  28.       writeln( Stick(0):2:h, ' ', Stick(1):2:h );
  29.     UNTIL keypress;
  30.     read(c);
  31.     End_Stick;
  32.   END.
  33.